﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.SessionState;
using GWEB.WebBase.Entity;
using GWEB.WebBase.Utility;
using GWEB.WebFrame.Public;

namespace GWEB.WebFrame.Models
{
    public class MealCourse
    {
        public PageInfo Init()
        {
            PageInfo pg = new PageInfo();
            pg.Type = "MealCourse";
            pg.Title = "";
            pg.AddText = "新增";
            pg.EditText = "";
            pg.LocateText = "查询";
            pg.SMenuId = "JX05";
            pg.FileUrl = "../MealCourses/MealCourse";
            pg.Condition = "";
            pg.TableName = "cu_Sys_contract";
            pg.KeyFieldName = "id";
            pg.PopEditHeight = 550;
            pg.PopEditWidth = 760;
            HttpSessionState session = System.Web.HttpContext.Current.Session;
            pg.dict = BasePage.getDict(session);
            pg.Sop = BasePage.Grant(session, pg.SMenuId);
            pg.Sop.DEL = false;
            pg.Sop.EDIT_htm = " ";
            pg.Tab.Add("课程", "LocatePara='';DataPageUrl='../Main/DataPageLay?type=BaseCourse';GoPage(1);");
            pg.Tab.Add("套餐", "LocatePara='';DataPageUrl='../Main/DataPageLay?type=MealCourse';GoPage(1);");
            string Url = "../MealCourses/MealCourse/UpdateState";//convert(varchar(10), cu_Account.id)
            string DelUrl = "../MealCourses/MealCourse/DelCourse";
            pg.Sql = @"select id,ContName,Remark,MaxLeave,MaxMakeUP,Price,LeagueId,Courses,
case  when IsClassHour=0 then (case  when HourFrequency=0 then '时长:'+convert(varchar,HourNumber)+'个月-无限次数' when HourFrequency>0 then '时长:'+convert(varchar,HourNumber)+'个月-'+convert(varchar,HourFrequency)+'/月' END)when IsClassHour=1 then '课时:'+convert(varchar,ClassHourNumber)+'/次课'   END as  IsClassHourContent ,
'<a class=''layui-btn layui-bg-red layui-btn-xs'' href=""javascript: Do(''" + DelUrl + @"'',{ id: '+ltrim(id)+',keyCode: GetKeyCode('''+ltrim(id)+''')})"" >删除</a>'  as link 
from  cu_Sys_contract where LeagueId=1 ";
            //  pg.Sql = "select * from cu_Account where LeagueId = 1"; cl.DictTypeID = "D18";
            ColumnInfo cl;
            cl = new ColumnInfo(); cl.FieldName = "ContName"; cl.HeadText = "套餐名称"; cl.Visible = true; cl.IsCondition = true; cl.ConditionPosition = 1; cl.Width = 80; pg.AddColumn(cl);
            cl = new ColumnInfo(); cl.FieldName = "IsClassHourContent"; cl.HeadText = "套餐类型"; cl.Visible = true; cl.Width = 80; pg.AddColumn(cl);
            //cl = new ColumnInfo(); cl.FieldName = "IsAllContent"; cl.HeadText = "适合系列"; cl.Visible = true; cl.Width = 80; pg.AddColumn(cl);
            cl = new ColumnInfo(); cl.FieldName = "Price"; cl.HeadText = "合同价格"; cl.Visible = true; cl.Width = 80; pg.AddColumn(cl);
            cl = new ColumnInfo(); cl.FieldName = "MaxLeave"; cl.HeadText = "最大请假数"; cl.Visible = true; cl.Width = 80; pg.AddColumn(cl);
            cl = new ColumnInfo(); cl.FieldName = "MaxMakeUP"; cl.HeadText = "最大补课数"; cl.Visible = true; cl.Width = 80; pg.AddColumn(cl);
            cl = new ColumnInfo(); cl.FieldName = "Remark"; cl.HeadText = "摘要"; cl.Visible = true; pg.AddColumn(cl);
            cl = new ColumnInfo(); cl.FieldName = "Courses"; cl.HeadText = "部分课程"; cl.Visible = false; pg.AddColumn(cl);
            cl = new ColumnInfo(); cl.FieldName = "link"; cl.HeadText = "操作"; cl.IsSort = false; pg.AddColumn(cl);
            return pg;
        }

    }
}